/*   1:    */ package org.intellij.images.options.impl;
/*   2:    */ 
/*   3:    */

import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.JDOMExternalizer;
import org.intellij.images.options.ZoomOptions;
import org.jdom.Element;

import java.awt.*;
import java.beans.PropertyChangeSupport;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */ 
/*  10:    */ final class ZoomOptionsImpl
/*  11:    */   implements ZoomOptions, JDOMExternalizable
/*  12:    */ {
/*  13:    */   private boolean a;
/*  14: 33 */   private boolean b = true;
/*  15: 34 */   private int c = DEFAULT_PREFFERED_SIZE.width;
/*  16: 35 */   private int d = DEFAULT_PREFFERED_SIZE.height;
/*  17:    */   private final PropertyChangeSupport e;
/*  18:    */   
/*  19:    */   ZoomOptionsImpl(PropertyChangeSupport paramPropertyChangeSupport)
/*  20:    */   {
/*  21: 39 */     this.e = paramPropertyChangeSupport;
/*  22:    */   }
/*  23:    */   
/*  24:    */   public boolean isWheelZooming()
/*  25:    */   {
/*  26: 43 */     return this.a;
/*  27:    */   }
/*  28:    */   
/*  29:    */   public boolean isSmartZooming()
/*  30:    */   {
/*  31: 47 */     return this.b;
/*  32:    */   }
/*  33:    */   
/*  34:    */   public Dimension getPrefferedSize()
/*  35:    */   {
/*  36: 51 */     return new Dimension(this.c, this.d);
/*  37:    */   }
/*  38:    */   
/*  39:    */   void setWheelZooming(boolean paramBoolean)
/*  40:    */   {
/*  41: 55 */     boolean bool = this.a;
/*  42: 56 */     if (bool != paramBoolean)
/*  43:    */     {
/*  44: 57 */       this.a = paramBoolean;
/*  45: 58 */       this.e.firePropertyChange("Editor.Zoom.wheelZooming", bool, this.a);
/*  46:    */     }
/*  47:    */   }
/*  48:    */   
/*  49:    */   void setSmartZooming(boolean paramBoolean)
/*  50:    */   {
/*  51: 63 */     boolean bool = this.b;
/*  52: 64 */     if (bool != paramBoolean)
/*  53:    */     {
/*  54: 65 */       this.b = paramBoolean;
/*  55: 66 */       this.e.firePropertyChange("Editor.Zoom.smartZooming", bool, this.b);
/*  56:    */     }
/*  57:    */   }
/*  58:    */   
/*  59:    */   void setPrefferedSize(Dimension paramDimension)
/*  60:    */   {
/*  61: 71 */     if (paramDimension == null) {
/*  62: 72 */       paramDimension = DEFAULT_PREFFERED_SIZE;
/*  63:    */     }
/*  64: 74 */     setPrefferedWidth(paramDimension.width);
/*  65: 75 */     setPrefferedHeight(paramDimension.height);
/*  66:    */   }
/*  67:    */   
/*  68:    */   void setPrefferedWidth(int paramInt)
/*  69:    */   {
/*  70: 79 */     int i = this.c;
/*  71: 80 */     if (i != paramInt)
/*  72:    */     {
/*  73: 81 */       this.c = paramInt;
/*  74: 82 */       this.e.firePropertyChange("Editor.Zoom.prefferedWidth", i, this.c);
/*  75:    */     }
/*  76:    */   }
/*  77:    */   
/*  78:    */   void setPrefferedHeight(int paramInt)
/*  79:    */   {
/*  80: 87 */     int i = this.d;
/*  81: 88 */     if (i != paramInt)
/*  82:    */     {
/*  83: 89 */       this.d = paramInt;
/*  84: 90 */       this.e.firePropertyChange("Editor.Zoom.prefferedHeight", i, this.d);
/*  85:    */     }
/*  86:    */   }
/*  87:    */   
/*  88:    */   public void inject(ZoomOptions paramZoomOptions)
/*  89:    */   {
/*  90: 95 */     setWheelZooming(paramZoomOptions.isWheelZooming());
/*  91: 96 */     setSmartZooming(paramZoomOptions.isSmartZooming());
/*  92: 97 */     setPrefferedSize(paramZoomOptions.getPrefferedSize());
/*  93:    */   }
/*  94:    */   
/*  95:    */   public boolean setOption(String paramString, Object paramObject)
/*  96:    */   {
/*  97:101 */     if ("Editor.Zoom.wheelZooming".equals(paramString)) {
/*  98:102 */       setWheelZooming(((Boolean)paramObject).booleanValue());
/*  99:103 */     } else if ("Editor.Zoom.smartZooming".equals(paramString)) {
/* 100:104 */       setSmartZooming(((Boolean)paramObject).booleanValue());
/* 101:105 */     } else if ("Editor.Zoom.prefferedWidth".equals(paramString)) {
/* 102:106 */       setPrefferedWidth(((Integer)paramObject).intValue());
/* 103:107 */     } else if ("Editor.Zoom.prefferedHeight".equals(paramString)) {
/* 104:108 */       setPrefferedHeight(((Integer)paramObject).intValue());
/* 105:    */     } else {
/* 106:110 */       return false;
/* 107:    */     }
/* 108:112 */     return true;
/* 109:    */   }
/* 110:    */   
/* 111:    */   public void readExternal(Element paramElement)
/* 112:    */   {
/* 113:116 */     setWheelZooming(JDOMExternalizer.readBoolean(paramElement, "Editor.Zoom.wheelZooming"));
/* 114:117 */     setSmartZooming(JDOMExternalizer.readBoolean(paramElement, "Editor.Zoom.smartZooming"));
/* 115:118 */     setPrefferedWidth(JDOMExternalizer.readInteger(paramElement, "Editor.Zoom.prefferedWidth", DEFAULT_PREFFERED_SIZE.width));
/* 116:119 */     setPrefferedHeight(JDOMExternalizer.readInteger(paramElement, "Editor.Zoom.prefferedHeight", DEFAULT_PREFFERED_SIZE.height));
/* 117:    */   }
/* 118:    */   
/* 119:    */   public void writeExternal(Element paramElement)
/* 120:    */   {
/* 121:123 */     JDOMExternalizer.write(paramElement, "Editor.Zoom.wheelZooming", this.a);
/* 122:124 */     JDOMExternalizer.write(paramElement, "Editor.Zoom.smartZooming", this.b);
/* 123:125 */     JDOMExternalizer.write(paramElement, "Editor.Zoom.prefferedWidth", this.c);
/* 124:126 */     JDOMExternalizer.write(paramElement, "Editor.Zoom.prefferedHeight", this.d);
/* 125:    */   }
/* 126:    */   
/* 127:    */   public boolean equals(Object paramObject)
/* 128:    */   {
/* 129:130 */     if (this == paramObject) {
/* 130:131 */       return true;
/* 131:    */     }
/* 132:133 */     if (!(paramObject instanceof ZoomOptions)) {
/* 133:134 */       return false;
/* 134:    */     }
/* 135:137 */     ZoomOptions localZoomOptions = (ZoomOptions)paramObject;
/* 136:    */     
/* 137:139 */     Dimension localDimension = localZoomOptions.getPrefferedSize();
/* 138:140 */     return (localDimension != null) && (this.d == localDimension.height) && (this.c == localDimension.width) && (this.b == localZoomOptions.isSmartZooming()) && (this.a == localZoomOptions.isWheelZooming());
/* 139:    */   }
/* 140:    */   
/* 141:    */   public int hashCode()
/* 142:    */   {
/* 143:149 */     int i = this.a ? 1 : 0;
/* 144:150 */     i = 29 * i + (this.b ? 1 : 0);
/* 145:151 */     i = 29 * i + this.c;
/* 146:152 */     i = 29 * i + this.d;
/* 147:153 */     return i;
/* 148:    */   }
/* 149:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.images.options.impl.ZoomOptionsImpl

 * JD-Core Version:    0.7.0.1

 */